package com.luxk.db.server;

/**
 * NONE -> NOMOUNT -> MOUNT --------> NORMAL
 *                      |               ^ 
 *                      |               | (failover시)
 *                      +--> STANDBY ---+
 * @author 김철우
 *
 */
public enum StartupMode {
	NONE(0, "NONE"),
	NOMOUNT(1, "NOMOUNT"),
	MOUNT(2, "MOUNT"),
	STANDBY(3, "STANDBY"),
	NORMAL(4, "NORMAL");
	
	private final int intVal;
	private final String strVal;
	
	StartupMode(int intVal, String strVal) {
		this.intVal = intVal;
		this.strVal = strVal;
	}
	
	public int getIntVal() { return this.intVal; }
	public String getStrVal() { return this.strVal; }

	public StartupMode getStartupMode(int intVal) {
		for(StartupMode m: StartupMode.values()) {
			if(intVal == m.getIntVal()) return m;
		}
		return StartupMode.NONE;
	}
	
	public StartupMode getStartupMode(String strVal) {

		for(StartupMode m: StartupMode.values()) {
			if(m.getStrVal().equalsIgnoreCase(strVal)) return m;
		}
		return StartupMode.NONE;
	}
}